<!DOCTYPE html>
<html>
    <head>
        <script src="vue.js"></script>
    </head>
    <body>
        <div id="app">
            <parent></parent>
        </div>
        <template id="child">
            <div>
            <button @click="click">Send</button>
            <input type="text" v-model="msg" />
        </div>
        </template>
        <script>
            Vue.component('parent',{
                template : '<div><child @childFn="transContent"></child>'+'子组件传来的值:{{message}}</div>',
                data : function() {
                    return { message: ''}
                },
                methods : {
                    tansContent(payload) {
                        this.message = payload;
                    }
                }
            });

            Vue.component('child',{
                template:'#child',
                data : function() {
                   return{ 
                       msg : '子组件的信息'
                    }
                },
                methods : {
                    click() {
                        this.$emit('childFn',this.msg);
                    }
                }
            });

            var vm = new Vue({el:'#app'});
        </script>
    </body>
</html>